#ifndef BLUETOOTH_AT_H
#define BLUETOOTH_AT_H

// Bluetooth AT command(蓝牙AT命令实现)

#include "./usart/usart.h"
#include "./delay/delay.h"

// bluetooth at command
#define AT_CMD_MODE "AT\r\n"                 // at command(发送AT命令)
#define AT_CMD_OK "OK"                       // OK command(OK)
#define AT_CMD_INIT_SPP "AT+INIT\r\n"        // init spp(初始化SPP)
#define AT_CMD_IAC "AT+IAC=9e8b33\r\n"       // scan every reading code bluetooth device(扫描每个读取代码蓝牙设备)
#define AT_CMD_DEVICE_CLASS "AT+CLASS=0\r\n" // scan every type of devices
#define AT_CMD_INQM "AT+INQM=1,9,48\r\n"     // scan mode
#define AT_CMD_INQ "AT+INQ?\r\n"             // scan bluetooth device(扫描蓝牙设备)
#define AT_CMD_INQC "AT+INQC\r\n"            // exit scan bluetooth device(退出扫描蓝牙设备)

#define BLUETOOTH_AT_MAX_LEN 256              // Bluetooth AT command max length(蓝牙AT命令最大长度)
#define BLUETOOTH_STATE_PIN GPIO_Pin_1        // Bluetooth AT state pin(蓝牙AT状态引脚)
#define BLUETOOTH_AT_MODE_PIN GPIO_Pin_4      // Bluetooth AT mode pin(蓝牙AT模式引脚)
#define BLUETOOTH_AT_USART_TX_PIN GPIO_Pin_9  // Bluetooth AT USART TX pin(蓝牙AT USART TX引脚)
#define BLUETOOTH_AT_USART_RX_PIN GPIO_Pin_10 // Bluetooth AT USART RX pin(蓝牙AT USART RX引脚)

extern void bluetooth_at_init(void);                                      // Bluetooth At Init(蓝牙AT初始化)
extern void bluetooth_at_send_cmd(char *String);                          // Bluetooth At Send Command(蓝牙AT发送命令)
extern void bluetooth_send_data_init(void);                               // Bluetooth Send Data Init(蓝牙发送数据初始化)
extern void bluetooth_scan_device(void);                                  // Bluetooth Scan Device(蓝牙扫描设备)
extern void bluetooth_connect_device(char *bluetADDR, uint32_t waitTime); // Bluetooth Connect Device(蓝牙连接设备)
extern void get_bluetooth_return_string(char *str, char *comp);           // Get Bluetooth Return String(获取蓝牙返回字符串)

#endif